<div class="page-wrapper d-flex flex-column pt-4">
    <div class="container-xl">
        <div class="page-header d-print-none">
            <div class="row align-items-center">
                <div class="col">
                    <div class="page-pretitle">
                        Listing
                    </div>
                    <h3 class="page-title">
                        All Users
                    </h3>
                </div>
            </div>
        </div>
    </div>
    <div class="page-body d-flex flex-row-reverse">

        <aside class="bd-sidebar sub-sidebar">

            <nav class="bd-links p-3" aria-label="Sub-section navigation">

                <div class="card card-body">
                    <filter-list request="request" callback="loadUsers(pageIndex)" create-url="createUrl"
                        create-text="'Create User'"></filter-list>
                </div>
            </nav>
        </aside>

        <!-- ----------------------------------------------------------- -->


        <div class="content-body py-3 pe-3">

            <div class="card mb-5">
                <div class="card-body">
                    <table class="table table-hover mb-0" cellspacing="0" ng-init="loadUsers(0)">
                        <thead class="thead-light">
                            <tr>
                                <!-- <th scope="col" width="20%">
                                    Id
                                </th> -->
                                <th scope="col" class="col">
                                    Username
                                </th>
                                <!-- <th scope="col" width="20%">
                            Roles
                        </th> -->
                                <th scope="col" class="col">
                                    Avatar
                                </th>
                                <th scope="col" class="col">
                                    Created Date
                                </th>

                                <th scope="col" class="col" class="text-end"></th>
                            </tr>
                        </thead>

                        <tbody class="sortable">
                            <tr ng-repeat="item in data.items track by $index" class="sortable-item" sort-model="user"
                                sort-model-id="{{item.id}}">
                                <!-- <td>
                                    <small><span ng-bind="item.id"></span></small>
                                </td> -->
                                <td>
                                    <small ng-bind="item.userName"></small>
                                </td>
                                <!-- <td>
                            <small>
                                <ul class="m-0 p-0">
                                    <li ng-repeat="ur in item.userRoles">
                                        <span ng-bind="ur.role.name"></span>
                                    </li>
                                </ul>
                            </small>
                        </td> -->
                                <td>
                                    <preview-image img-height="25" img-src="item.avatarUrl"></preview-image>
                                </td>
                                <td>
                                    <small class="text-black-50">
                                        {{item.joinDate | utcToLocal:'d.M.yyyy h:mm a'}}
                                    </small>
                                </td>
                                <td>
                                    <div class="btn-group btn-group-sm btn-group-sm float-end" role="group"
                                        aria-label="Actions">
                                        <a href="/portal/user/details/{{item.id}}" class="btn btn-link text-primary">
                                            <span class="fa fa-pen"></span>
                                        </a>
                                        <a ng-click="removeUser(item.id);" class="btn btn-link text-danger">
                                            <span class="fas fa-trash-alt"></span>
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="card-body">

                    <paging class="small" page="data.page" page-size="data.pageSize" total="data.totalItems"
                        ul-class="pagination justify-content-end m-0" a-class="page-link"
                        paging-action="loadUsers(page-1)" scroll-top="true">
                </div>
            </div>
        </div>

    </div>
</div>